from threading import local
from threading import Thread
import time 


"""
xianglong = -1 
def task(arg):
    global xianglong
    xianglong = arg
    time.sleep(2) # 
    print(xianglong)

for i in range(10):
    t = Thread(target=task,args=(i,))
    t.start()
"""

# 特殊的对象.
xianglong = local()

def task(arg):
    # 对象.val = 1/2/3/4/5
    xianglong.value = arg 
    time.sleep(2)
    print(xianglong.value)


for i in range(10):
    t = Thread(target=task,args=(i,))
    t.start()



